import { defineStore } from 'pinia'
import { computed, ref } from 'vue'


export const useCounterStore = defineStore('counter', () => {
  const count = ref<number>(0)

  const doubleCount = computed<number>(() => {
    return 2 * count.value
  })

  const increment = () => {
    count.value++
  }

  const asyncIncrement = () => {
    setTimeout(() => {
      count.value++
    }, 1000)
  }

  return {
    count, increment, asyncIncrement, doubleCount
  }
})


